From: kaf24@freefall.cl.cam.ac.uk Date: Wed, 8 Sep 2004 21:09:16 +0000 (+0000) Subject: bitkeeper revision 1.1159.1.141 (413f74fcTwJtxfSqPOLD17o7tsdJbg) X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~17400^2~610 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22%22?a=commitdiff_plain;h=ce0e436c080cb3f998fd3913ac29ae8dcedea8ae;p=xen.git bitkeeper revision 1.1159.1.141 (413f74fcTwJtxfSqPOLD17o7tsdJbg) Freed PTEs now pass through the TLB-gathering mechanism, as is correct. We hook them back off into the pte caching allocator using the SetForeignHeap() mechanism that I added for the network backend. --- diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig index 5beabc830d..2bbe0229b4 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/Kconfig @@ -45,8 +45,7 @@ endmenu config FOREIGN_PAGES bool - default y if XEN_PHYSDEV_ACCESS - default n if !XEN_PHYSDEV_ACCESS + default y config PAGESIZED_SKBS bool diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig index 70e8811692..8d0d9fc5a3 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig +++ b/linux-2.6.8.1-xen-sparse/arch/xen/configs/xenU_defconfig @@ -11,7 +11,7 @@ CONFIG_NO_IDLE_HZ=y # CONFIG_XEN_PRIVILEGED_GUEST is not set # CONFIG_XEN_PHYSDEV_ACCESS is not set CONFIG_XEN_WRITABLE_PAGETABLES=y -# CONFIG_FOREIGN_PAGES is not set +CONFIG_FOREIGN_PAGES=y # CONFIG_PAGESIZED_SKBS is not set CONFIG_X86=y # CONFIG_X86_64 is not set diff --git a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c index bebd04f92d..4516df1643 100644 --- a/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c +++ b/linux-2.6.8.1-xen-sparse/arch/xen/i386/mm/pgtable.c @@ -187,6 +187,9 @@ pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) void pte_ctor(void *pte, kmem_cache_t *cache, unsigned long unused) { + struct page *page = virt_to_page(pte); + SetPageForeign(page, pte_free); + set_page_count(page, 1); clear_page(pte); __make_page_readonly(pte); @@ -196,6 +199,8 @@ void pte_ctor(void *pte, kmem_cache_t *cache, unsigned long unused) void pte_dtor(void *pte, kmem_cache_t *cache, unsigned long unused) { + struct page *page = virt_to_page(pte); + ClearPageForeign(page); queue_pte_unpin(virt_to_phys(pte)); __make_page_writable(pte); @@ -225,6 +230,20 @@ struct page *pte_alloc_one(struct mm_struct *mm, unsigned long address) return NULL; } +void pte_free(struct page *pte) +{ + set_page_count(pte, 1); +#ifdef CONFIG_HIGHPTE + if (pte < highmem_start_page) +#endif + kmem_cache_free(pte_cache, + phys_to_virt(page_to_pseudophys(pte))); +#ifdef CONFIG_HIGHPTE + else + __free_page(pte); +#endif +} + void pmd_ctor(void *pmd, kmem_cache_t *cache, unsigned long flags) { memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); diff --git a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h index 3d36223eca..559df16eac 100644 --- a/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h +++ b/linux-2.6.8.1-xen-sparse/include/asm-xen/asm-i386/pgalloc.h @@ -36,21 +36,9 @@ static inline void pte_free_kernel(pte_t *pte) flush_page_update_queue(); } -static inline void pte_free(struct page *pte) -{ -#ifdef CONFIG_HIGHPTE - if (pte < highmem_start_page) -#endif - kmem_cache_free(pte_cache, - phys_to_virt(page_to_pseudophys(pte))); -#ifdef CONFIG_HIGHPTE - else - __free_page(pte); -#endif -} - +extern void pte_free(struct page *pte); -#define __pte_free_tlb(tlb,pte) pte_free(pte) +#define __pte_free_tlb(tlb,pte) tlb_remove_page((tlb),(pte)) /* * allocating and freeing a pmd is trivial: the 1-entry pmd is